# plotly standard imports
import plotly.graph_objs as go
import chart_studio.plotly as py
# Cufflinks wrapper on plotly
import cufflinks
# Data science imports
import pandas as pd
import numpy as np
# Options for pandas
pd.options.display.max_columns = 30
# Display all cell outputs
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = 'all'
from plotly.offline import iplot, init_notebook_mode
cufflinks.go_offline(connected=True)
init_notebook_mode(connected=True)
# Set global theme
cufflinks.set_config_file(world_readable=True, theme='pearl')
from src.prepare_datasets import make_window_generator, get_prepared_datasets
train_df, test_df = get_prepared_datasets()
train, test = make_window_generator()
from src.libs import checkpoints
from src.model import build_model
model = build_model()
model = checkpoints.load_weights(model)
import tensorflow as tf
input_window, label_window = next(iter(test))
predictions = model.predict(test, verbose=1, use_multiprocessing=True)
1773/1773 [==============================] - 35s 18ms/step
test2predictions = pd.DataFrame({
'Test': test_df['close'][:len(predictions)],
'Predicted': [ x[0] for x in predictions]
})
test2predictions.index = test_df[:len(predictions)].index
test2predictions.iplot()